import './assets/main.css'

import { createApp } from 'vue'
import pinia from '@/stores/index'


import App from './App.vue'
import router from './router'

import elementPlus from 'element-plus'
// import 'element-plus/dist/index.css'
import './style/index.scss'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 初始化主题存储
import { useThemeStore } from '@/stores/theme'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(pinia)
app.use(router)
app.use(elementPlus)

// 确保主题在应用挂载前初始化
const themeStore = useThemeStore()
themeStore.applyTheme(themeStore.currentTheme)

app.mount('#app')
